package cn.edu.ctbu.bootstraptablepage.controller;

import cn.edu.ctbu.bootstraptablepage.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/student")
public class StudentController {

    @Autowired
    StudentService studentService;
    /**
     * 渲染list.html
     * @return
     */
    @GetMapping("list")
    public String list(HttpServletRequest request){

        HttpSession session = request.getSession();
        if(session.getAttribute("userid") == null){
            //没有登录，需要去登录

            return "redirect:/login/user";
        }
        return "student/list";
    }

}
